﻿using SocketioTest.ViewModel;
using System;
using System.Collections.Generic;
using static socketio.socketio.Data;

namespace SocketioTest
{
    public static class Global 
    {
        public static string urlPath = "http://www.laraveldemo.com/index.php/api"; //服务器地址

        public static string socketIoServerUrl = "http://172.17.80.168:3000";

        //public static string urlPath = "http://192.168.101.45/index.php/api"; //服务器地址

        //public static string socketIoServerUrl = "http://192.168.101.45:3000";

        public static int uid;
        public static string name;
        public static string avatar; 
        public static string access_token;

        public static List<ChatRecord> chatMessageList = new List<ChatRecord>(); // 聊天记录


        /// <summary>
        /// 获取当前时间戳
        /// </summary>
        /// <param name="bflag">为真时获取10位时间戳,为假时获取13位时间戳.bool bflag = true</param>
        /// <returns></returns>
        public static string GetTimeStamp(bool bflag)
        {
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            string ret = string.Empty;
            if (bflag)
            {
                ret = Convert.ToInt64(ts.TotalSeconds).ToString();
            }
            else
            {
                ret = Convert.ToInt64(ts.TotalMilliseconds).ToString();
            }
            return ret;
        }
    }

}
